﻿using System;
using SharpSqlAnalyzer.nodes;

namespace SharpSqlAnalyzer.stmt.db2
{
	// Token: 0x020001CF RID: 463
	public class TDb2CaseStmt : TCustomDb2Stmt
	{
		// Token: 0x06000F7D RID: 3965 RVA: 0x0030B8F4 File Offset: 0x00309AF4
		public TDb2CaseStmt(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sstdb2casestmt;
		}

		// Token: 0x06000F7E RID: 3966 RVA: 0x0030B908 File Offset: 0x00309B08
		internal override void buildsql()
		{
		}

		// Token: 0x06000F7F RID: 3967 RVA: 0x0030B90A File Offset: 0x00309B0A
		internal override void clear()
		{
		}

		// Token: 0x06000F80 RID: 3968 RVA: 0x0030B90C File Offset: 0x00309B0C
		internal override string getasprettytext()
		{
			return "";
		}

		// Token: 0x06000F81 RID: 3969 RVA: 0x0030B913 File Offset: 0x00309B13
		internal override void iterate(TVisitorAbs pvisitor)
		{
		}

		// Token: 0x06000F82 RID: 3970 RVA: 0x0030B918 File Offset: 0x00309B18
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			if (this.rootNode == null)
			{
				return -1;
			}
			base.doParseStatement(psql);
			TCaseExpression tcaseExpression = (TCaseExpression)this.rootNode;
			this.expr = tcaseExpression.Input_expr;
			if (this.expr != null)
			{
				this.expr.doParse(this, ESqlClause.unknown);
			}
			this.whenClauseItemList = tcaseExpression.WhenClauseItemList;
			this.whenClauseItemList.doParse(this, ESqlClause.unknown);
			if (tcaseExpression.Else_statement_node_list != null)
			{
				tcaseExpression.Else_statement_node_list.doParse(psql, ESqlClause.unknown);
				for (int i = 0; i < tcaseExpression.Else_statement_node_list.size(); i++)
				{
					this.ElseStatementList.add(tcaseExpression.Else_statement_node_list.getStatementSqlNode(i).Stmt);
				}
			}
			return 0;
		}

		// Token: 0x170002E4 RID: 740
		// (get) Token: 0x06000F83 RID: 3971 RVA: 0x0030B9C5 File Offset: 0x00309BC5
		// (set) Token: 0x06000F84 RID: 3972 RVA: 0x0030B9CD File Offset: 0x00309BCD
		public virtual TExpression Expr
		{
			get
			{
				return this.expr;
			}
			set
			{
				this.expr = value;
			}
		}

		// Token: 0x170002E5 RID: 741
		// (get) Token: 0x06000F85 RID: 3973 RVA: 0x0030B9D6 File Offset: 0x00309BD6
		// (set) Token: 0x06000F86 RID: 3974 RVA: 0x0030B9DE File Offset: 0x00309BDE
		public virtual TWhenClauseItemList WhenClauseItemList
		{
			get
			{
				return this.whenClauseItemList;
			}
			set
			{
				this.whenClauseItemList = value;
			}
		}

		// Token: 0x170002E6 RID: 742
		// (get) Token: 0x06000F87 RID: 3975 RVA: 0x0030B9E7 File Offset: 0x00309BE7
		// (set) Token: 0x06000F88 RID: 3976 RVA: 0x0030BA02 File Offset: 0x00309C02
		public virtual TStatementList ElseStatementList
		{
			get
			{
				if (this.elseStatementList == null)
				{
					this.elseStatementList = new TStatementList();
				}
				return this.elseStatementList;
			}
			set
			{
				this.elseStatementList = value;
			}
		}

		// Token: 0x06000F89 RID: 3977 RVA: 0x0030BA0C File Offset: 0x00309C0C
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			if (this.expr != null)
			{
				this.expr.accept(v);
			}
			this.whenClauseItemList.accept(v);
			if (this.ElseStatementList.size() > 0)
			{
				this.ElseStatementList.accept(v);
			}
			v.postVisit(this);
		}

		// Token: 0x04001376 RID: 4982
		private TExpression expr;

		// Token: 0x04001377 RID: 4983
		private TWhenClauseItemList whenClauseItemList;

		// Token: 0x04001378 RID: 4984
		private TStatementList elseStatementList;
	}
}
